import java.time.LocalDate;
import java.time.DayOfWeek;
import java.util.Scanner;

public class DayOfWeekCalculator {
    public static void main(String[] args) {
        // 获取用户输入的年月日
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年月日，格式为：年-月-日"+"——如1999-01-01");
        System.out.print("请输入：");
        String yearAndMonthDay = scanner.next();
        // 使用 LocalDate 类解析输入的日期字符串
        LocalDate date = LocalDate.parse(yearAndMonthDay);
        // 获取用户输入的年份、月份和日期
        int year = date.getYear();
        int month = date.getMonthValue();
        int day = date.getDayOfMonth();

        // 计算并输出星期几
        DayOfWeek dayOfWeek = calculateDayOfWeek(year, month, day);
        System.out.println(year + "年" + month + "月" + day + "日是" + dayOfWeek);
    }
    private static DayOfWeek calculateDayOfWeek(int year, int month, int day) {
        // 创建 LocalDate 对象
        LocalDate date = LocalDate.of(year, month, day);
        // 获取星期几
        return date.getDayOfWeek();
    }
}